// components/tab-bar/tab-bar.ts
Component({
	/**     * 组件的属性列表     */
	properties: {
		idx: {
			type: Number,
			value: 0
		},
	},
	/**     * 组件的初始数据     */
	data: {
		tabBar: [{
            "pagePath": "/pages/index/index",
            "text": "首页",
            "iconPath": "../../static/img/home.png",
            "selectedIconPath": "../../static/img/home-active.png"
        },
        {
            "pagePath": "/pages/my/my",
            "text": "我的",
            "iconPath": "../../static/img/my.png",
            "selectedIconPath": "../../static/img/my-active.png"
        }]
	},
	/**     * 组件的方法列表     */
	methods: {
        goToTab(e: any) {
            if (this.data.idx == e.currentTarget.dataset.index) {
                return 
            }
            wx.switchTab({
                url: e.currentTarget.dataset.url
            })
        }
    }
})